﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace MasterSheetManager.Models
{
    public class Deal : CompanyRelationshipChildItem
    {
        decimal? AveragePoll;
  
        [Display(Name = "项目名称"), Required]
        public int? ProjectID { get; set; }

        [Display(Name = "出单号")]
        public string DealCode { get; set; }

        [Display(Name = "客户签单人"), Required]
        public string Committer { get; set; }

        [Display(Name = "参会客户")]
        public virtual List<Participant> Participants { get; set; }

        [Display(Name = "签单人联系方式"), Required]
        public string CommitterContect { get; set; }

        [Required]
        [Display(Name = "签单人邮箱")]
        [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", ErrorMessage = "请输入的有效的签单人邮箱")]
        public string CommitterEmail { get; set; }

        [Display(Name = "会务须知权益描述"), MaxLength(2000)]
        public string TicketDescription { get; set; }

        public virtual Package Package { get; set; }
        [Display(Name = "销售Package"), Required]
        public int? PackageID { get; set; }


        [Display(Name = "坏账")]
        public bool Abandoned { get; set; }

        [Display(Name = "坏账原因")]
        public string AbandonReason { get; set; }

        [Display(Name = "备注")]
        public string Remark { get; set; }

        [Display(Name = "合约付款日期"), Required]
        public DateTime ExpectedPaymentDate { get; set; }

        [Display(Name = "实际付款日期")]
        public DateTime? ActualPaymentDate { get; set; }

        [Display(Name = "签约日期")]
        public DateTime? SignDate { get; set; }

        [Display(Name = "是否付款")]
        public bool IsClosed { get; set; }

        [Display(Name = "实际入账")]
        public decimal Income { get; set; }

        [Display(Name = "出单人"), Required]
        public string Sales { get; set; }

        [Display(Name = "应付款"), Required]
        [Range(1000.0, 100000000.0, ErrorMessage = "应付款必须大于等于1000")]
        public decimal Payment { get; set; }

        [Display(Name = "币种")]
        [Required(ErrorMessage = "必须选择币种")]
        public int CurrencyTypeID { get; set; }

        [Display(Name = "出单经验分享"), MaxLength(2000), Required]
        public string PaymentDetail { get; set; }

        [Display(Name = "是否确认")]
        public bool? IsConfirm { get; set; }

        [Display(Name = "确认人")]
        public string Confirmor { get; set; }

        [Display(Name = "票数"), Required]
        public int Poll { get; set; }

        [Display(Name = "删除")]
        public bool? Deleted { get; set; }

        [Display(Name = "出单类型")]
        public string DealType { get; set; }
    }
}